/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.clinicplus.entity;

import br.com.foxline.clinicplus.enums.PaymentType;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;

/**
 *
 * @author roniere
 */
@Entity
public class Order implements Serializable{
    
    @Id
    @SequenceGenerator(sequenceName = "seq_order", name = "seq_order", allocationSize = 1)
    @GeneratedValue(generator = "seq_order", strategy = GenerationType.SEQUENCE)
    private Long id;
    
    @OneToOne
    private Diary diary;
    
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date createAt;
    
    @Column(scale= 4, precision=19)
    @DecimalMin( value = "0.00" )
    @Digits( fraction = 4, integer = 10 )
    private BigDecimal amount;
    
    @Enumerated(EnumType.STRING)
    private PaymentType paymentType;
    
    @ManyToOne
    private SystemUser systemUser;

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Date createAt) {
        this.createAt = createAt;
    }

    public Diary getDiary() {
        return diary;
    }

    public void setDiary(Diary diary) {
        this.diary = diary;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public PaymentType getPaymentType() {
        return paymentType;
    }

    public void setPaymentType(PaymentType paymentType) {
        this.paymentType = paymentType;
    }

    public SystemUser getSystemUser() {
        return systemUser;
    }

    public void setSystemUser(SystemUser systemUser) {
        this.systemUser = systemUser;
    }

    @Override
    public String toString() {
        return "Order{" + "id=" + id + ", diary=" + diary + ", createAt=" + createAt + ", amount=" + amount + ", paymentType=" + paymentType + ", systemUser=" + systemUser + '}';
    }
    
}
